package cc.linker.steplink.crm.merchanth5.dao;

import cc.linker.steplink.crm.merchanth5.model.OrderAddressDto;
import cc.linker.steplink.crm.merchanth5.pojo.*;
import cc.linker.steplink.crm.merchanth5.pojo.userInfo.UserAccountExtendInfoPo;
import org.apache.ibatis.annotations.Param;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface MallDao {
    int getMerchantGoodsNum(Map map);

    List<MallGoodsPo> getMerchantGoodsList(Map map);

    MallGoodsPo getMerchantGoodsInfo(Map map);

    List<MallGoodsSkuPo> getMerchantGoodsSku(@Param("goodsId") String goodsId);

    List<MallGoodsSpecPo> getMerchantGoodsSpec(@Param("goodsId") String goodsId);

    MallGoodsSpecValuePo getMerchantGoodsSpecValue(Map map);

    List<ShoppingCartPo> getUserShoppingCart(Map map);

    List<ShoppingCartGoodsPo> getShoppingCartMerchantGoods(Map map);

    ShoppingCartGoodsPo getShoppingCartMerchantGoodsById(Map map);

    ShoppingCartGoodsPo getShoppingCartMerchantGoodsByGoodsSku(Map map);

    ShoppingCartGoodsPo getShoppingCartMerchantGoodsByGoods(Map map);

    void addShoppingCart(Map map);

    void editShoppingCart(Map map);

    void delShoppingCart(Map map);

    void delAllShoppingCart(Map map);

    ShoppingCartGoodsPo checkShoppingGoodsOrder(Map map);

    List<ShoppingCartPo> checkShoppingCartOrder(Map map);

    OrderAddressDto getDefaultReceiveAddress(Map map);

    List<OrderAddressDto> getReceiveAddressList(Map map);

    void addReceiveAddress(Map map);

    void setReceiveAddressUndefault(Map map);

    void updateReceiveAddress(Map map);

    void delReceiveAddress(Map map);

    List<ShoppingCartPo> getShoppingCartByIds(Map map);

    ShoppingCartGoodsPo getShoppingGoodsInfo(Map map);

    int updateGoodsCount(Map map);

    int updateGoodsSkuCount(Map map);

    int addGoodsCount(Map map);

    int addGoodsSkuCount(Map map);

    void insertMerchantOrderInfo(MerchantOrderPo merchantOrderPo);

    void insertMerchantOrderGoods(List list);

    List<MerchantOrderPo> getMerchantOrderByPayTradeId(String orderSn);

    void updateMerchantOrderInfo(Map map);

    int closeMerchantOrderInfo(Long orderId);

    void updateMerchantOrderGoodsInfo(Map map);

    int getUserOrderCount(Map map);

    int getSalerOrderCount(Map map);

    List<MerchantOrderPo> getUserOrderList(Map map);

    List<MerchantOrderPo> getSalerOrderList(Map map);

    MerchantOrderPo getUserOrderInfoById(Map map);
    MerchantOrderPo getUserIntegralOrderInfoBySn(String orderSn);

    List<MerchantOrderGoodsPo> getMerchantOrderGoodsList(Map map);

    List<MerchantOrderGoodsPo> getMerchantOrderGoodsList2(Map map);

    List<MerchantOrderGoodsPo> getIntegralOrderGoodsList(Long orderId);

    void deleteShoppingCartById(Long shoppingCartId);

    OrderAddressDto getReceiveAddressListById(Long addressId);

    void delShoppingOrder(Map map);

    void delIntegralShoppingOrder(Map map);

    void cancelShoppingOrder(Map map);

    void checkReceiveOrder(Map map);
    void checkReceiveIntegralOrder(Map map);

    UserAccountExtendInfoPo getTreadeMerchantAccountInfo(Map map);

    void insertGoodsTradeRecord(Map map);

    void updateMerchantAccount(Map map);

    void updateGoodSalesNum(MerchantOrderGoodsPo merchantOrderGoodsPo);

    Integer getIfGoodsSetSku(Map map);

    HashMap<String, Object> getOrderByPayTradeId(String outTradeNo);

    void addPayTrade(Map map);

    List<Map<String, Object>> getOrderGoodsByOrderId(Integer goodsId);

    void editGoodSalesNum(Map map);

    HashMap<String, Object> getAddressInfo(Map map);

    HashMap<String, Object> getSkuInfo(Integer skuId);

    HashMap<String, Object> getGoodsInfo(Integer goodsId);

    int addOrder(Map map);

    int addOrderGoods(List list);

    int countGoodsInfoByTradeId(Map<String, String> paramsMap);

    MallGoodsSharePo getGoodsInfoByTradeId(Map<String, String> paramsMap);

    int updateTradeInfoByParams(Map<String, Object> params);

    String getGoodsFreezeTimeByTradeId(Map<String, Object> params);

    int updateAccountFreeze(Map<String, Object> tradeShareParams);

    Long getUseableMoneyByUid(String belongId);

    int updateAccountBalance(Map map);

    String getBelongIdByGoodsId(Long goodsId);

    /**
     * 通过机构id获取营销机器人的开启状态
     * @param orgId
     * @return
     */
    Integer getRobotStatusByOrgId(String orgId);

    /**
     * 通过商品id获取关联的文章id
     * @param goodsId
     * @return
     */
    List<String> getArticleIdByGoodsId(Long goodsId);

    /**
     * 通过文章id更新购买次数(仅+1)
     * @param articleId
     */
    void updateBuyTimesByArticleId(String articleId);

    /**
     * 插入到成交数据记录表
     * @param params
     */
    void addToDealData(Map<String, Object> params);

    /**
     * 判断是否为第一次
     * @param params
     */
    Integer judgeFirstTimeByCidOidAndType(Map<String, Object> params);

    /**
     * 通过订单sn判断订单中的商品是否是营销中商品
     * @param orderSn
     * @return
     */
    Integer judgeOrderInMarketing(String orderSn);

    /**
     * 通过订单id找订单sn
     * @param orderId
     * @return
     */
    String getOrderSnByOrderId(Integer orderId);

    /**
     * 根据文章id和customerId判断该文章是否为24小时内推送给该用户的
     * @param map
     * @return
     */
    Integer judgeArticleSendWithinOneDayByNewsId(Map<String, Object> map);

    /**
     * 根据订单SN查询订单对应商品所关联到的文章
     * @param orderSn
     * @return
     */
    List<String> getArticleIdByOrderSn(String orderSn);

    /**
     * 根据customerId查24小时内发送过的文章
     * @param map
     * @return
     */
    String getArticleIdSendWithinOneDayByNewsId(Map<String, Object> map);

    /**
     * 根据机构id查机构的支付模式
     * @param params
     * @return
     */
    Integer getPayModeByOrgId(Map<String, Object> params);

    /**
     * 恢复用户订单支付的积分
     * @param params
     */
    void recoveryScore(Map<String, Object> params);

    /**
     * 恢复用户积分
     * @param params
     */
    void recoveryScoreById(Map<String, Object> params);

    /**
     * 查订单是否已经取消（本可以用update的AffectedRows来判断，但是不想改Mysql的配置）
     * @param params
     * @return
     */
    Integer checkOrderIfCancel(Map<String, Object> params);

    /**
     * 查订单是否已经确认，同上
     * @param params
     */
    Integer checkOrderIfReceive(Map<String, Object> params);

    /**
     * 根据token查机构的支付模式
     * @param token
     * @return
     */
    Integer getPayModeByToken(String token);


    List<Map<String,Object>> getOrderGoods(Map<String, Object> params);

    Map<String, Object> getOrderInfoBySn(String orderSn);

    Long getGoodsAmountByIds(Map<String, Object> param);

    List<String> getOrderGoodsIds(String orderId);

    void saveOrderGoodsRefund(Map<String, Object> params);

    String getOrderIdByOrderSn(String orderSn);

    void saveOrderRefund(Map<String, Object> orderData);

    List<Map<String, Object>> getOrderGoodsInfo(Map<String, Object> param);

    List<Map<String, Object>> getIntegralOrderGoodsInfo(Map<String, Object> param);

    List<Map<String, Object>> getOrderGoodsByShipping(Map<String, Object> da);

    List<Map<String, Object>> getIntegralOrderGoodsByShipping(Map<String, Object> da);

    void editOrderAddress(Map<String, Object> param);

    void editIntegralOrderAddress(Map<String, Object> param);

    Map<String, Object> getOrderGoodsInfoByOid(Map<String, Object> param);

    String getIfEnd(Map<String, Object> params);

    Integer getOrderGoodsCountByOrderSn(String orderId);

    Integer countCartBuyNum(Map<String, Object> params);

    Integer getPayStatus(Map<String, Object> param);

    AppPayPo getAppPayPoByOrderSn(String orderSn);

    Map<String,Object> getMerchantIdByGoodsId(String goodsId);

    List<Map> getMerchant(Map<String, Object> params);

    String getStoreNameByMerchantId(Long merchantId);

    String getIsEndByOrderSn(String orderSn);

    Integer getEnrollPayStatus(Map<String, Object> param);

    Integer getSalerPayStatus(Map<String, Object> param);

    List<String> getShoppingCartMerchantId(Map<String, Object> map);

    String getShoppingCartDistributor(Map<String, Object> disMap);

    String getOrderDistributor(String paySn);

    List<Map<String,Object>> getAllGoodsList();

    List<Map<String, Object>> getAllSkuList();

    Long getSkuIdByGoodsIdAndSkuKey(Map<String, Object> params);

    Map<String,Object> getSkuById(@Param("skuId") String skuId);

    List<Map<String, Object>> getMallsGoodsList(@Param("mallsGoodsId") Long mallsGoodsId,@Param("goodsId") Long goodsId);

    List<Map<String, Object>> getMallsGoodsSkuList(@Param("mallsSkuId") Long mallsSkuId,@Param("skuId") String skuId);

    int updateGoodsAllCount(Map<String, Object> mapM);

    int updateSkuAllCount(Map<String, Object> mapSku);

    void addMallGoodsCount(Map<String, Object> mapM);

    String getGoodsIdByShippingCode(@Param("shippingCode") String shippingCode,@Param("orderSn") String orderSn);
    String getIntegralGoodsIdByShippingCode(@Param("shippingCode") String shippingCode,@Param("orderSn") String orderSn);

    Map<String, Object> getMallDetail(Map<String, Object> param);

    Long getScore(Map<String, Object> params);

    OrderScore getOrderScore(@Param("orderId") String orderId);

    Integer getVipPayStatus(Map<String, Object> param);

    int getUserFundCount(Map<String, Object> params);

    List<MerchantRefundGoodsPo> getMerchantRefundGoodsList(Map<String, Object> params);

    List<Map<String, Object>> getIntegralGoodslist(@Param("orgId") String orgId,@Param("goodsType") Integer goodsType,@Param("groupId") Long groupId);

    List<Map<String, Object>> getIntegralOrderList(String customerId);

    Integer getIntegralPayStatus(Map<String, Object> param);

    List<Map<String, Object>> getGoodsService(Integer goodsId);

    Integer getIsSeckillByGoodsId(@Param("goodsId") String goodsId);

    Map getSeckillByGoodsId(@Param("goodsId") String goodsId);

    Integer getVipLevel(@Param("customerId") String customerId);

    Integer getVipIdCount(@Param("customerId") String customerId,@Param("vipIds") String vipIds);

    String getVipName(@Param("vipIds")String vipIds);

    List<Map<String, Object>> getIntegralLogListByLocal(Map<String, Object> param);

    void editGoodSkuSalesNum(Map<String, Object> param);

    void editMallGoodSkuSalesNum(Map<String, Object> param);

    void editMallGoodSkuSalesNumZ(Map<String, Object> map);

    List<Map> getIntegralGrouplist(@Param("orgId") String orgId);

    List<Map> getIntegralGroupGoodslist(Map group);

    Integer getIsVirtualByGoodsId(@Param("goodsId") String goodsId);
}
